package main

import (
	"os"

	"clean/infra/wire"

	"clean/infra/config"
	"clean/infra/log"

	_ "clean/infra/io/console/cobra"
	_ "clean/infra/io/console/urfave"
	_ "clean/infra/io/http/gin"
	_ "clean/infra/io/http/std"
	_ "clean/infra/io/rpc/rpcx"
	_ "clean/infra/io/websocket/nhooyr"

	_ "clean/infra/repo/sql/sqlx"
)

func main() {
	var serverName = "websocket_nhooyr"
	var repoName = "sql_sqlx"
	cfg := &config.Config{
		Dialect: struct {
			Io   string
			Repo string
		}{Io: serverName, Repo: repoName},
	}
	cfg.Repo.Sql.Sqlx.Driver = "sqlite3"
	cfg.Io.Http.Gin.Port = 8080
	server, err := wire.InitServer(*cfg)
	if err != nil {
		log.Error(err)
		os.Exit(1)
		return
	}

	err = server.Start()
	if err != nil {
		os.Exit(1)
	}
}
